﻿using System.ComponentModel;

namespace KeyboardCount
{
    internal class MyList : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;
        private string key = "";
        private int value = 0;

        public MyList()
        {

        }

        public MyList(string key, int value)
        {
            Key = key;
            Value = value;
        }


        public string Key
        {
            get { return key; }
            set
            {
                if (!key.Equals(value))
                {
                    key = value;
                    OnPropertyChanged("Key");
                }
            }
        }
        public int Value
        {
            get { return value; }
            set
            {
                if (!this.value.Equals(value))
                {
                    this.value = value;
                    OnPropertyChanged("Value");
                }
            }
        }

        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
